
/**
*
* disparo normal de megaman
*
**/

process buster()
public
	int change_angle;
private
	int BUSTER_SPRITE = 1;

	int velocity;
	int direction;
	
	megaman *super;
begin

velocity = 2;
change_angle = false;
super = &megaman_id;

direction = super.lookAt;
super.current_shots = super.current_shots + 1;

ctype = c_scroll;
graph = BUSTER_SPRITE;
file = fpg_ids.fpg_megaman_extras;

// coordenadas de donde sale el disparo 
switch (super.current_action)
	case  M_WALK_ACTION, M_SHOT_ACTION:
		x = super.x + 40 * super.lookAt;
		y = super.y - 22 * super.floorAt;
	end
	case M_JUMP_ACTION, M_FALL_ACTION:
		x = super.x + 35 * super.lookAt;
		y = super.y - 25 * super.floorAt;
	end
	case M_SLIDE_ACTION:
		x = super.x + 35 * super.lookAt;
		y = super.y - 25 * super.floorAt;
	end
	case M_LADDER_ACTION:
		x = super.x + 35 * super.lookAt;
		y = super.y - 25 * super.floorAt;
	end
end

// bucle principal
loop
	
	if (!change_angle)
		x = x + velocity * direction;
		velocity = (velocity >= 8) ? velocity = 8 : velocity += 2;
	else
		velocity = 15;
		// cambia la direccion del disparo
		xadvance((direction == D_RIGHT) ? 140000 : 40000, velocity);
	end
	
	// si el disparo sale de la pantalla
	if (out_region(id, 0))
		// proteccion contra errores
		if (exists(*super))
			if (super.current_shots > 0)
				super.current_shots = super.current_shots - 1;
			end
		end
		signal(id, s_kill);
	end		
	
	frame;	
// fin de loop	
end
// fin del proceso
end

